﻿<UserControl x:Class="ContactTracing.CaseView.Controls.ShortLabResultForm"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:p="clr-namespace:ContactTracing.CaseView.Properties"
             xmlns:local="clr-namespace:ContactTracing.CaseView.Controls"
             xmlns:wpf="clr-namespace:ContactTracing.Controls;assembly=ContactTracing.WPF"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             IsVisibleChanged="UserControl_IsVisibleChanged"
             d:DesignHeight="2500" d:DesignWidth="890">
    <UserControl.Resources>
        <Style TargetType="DatePicker">
            <Setter Property="Validation.ErrorTemplate">
                <Setter.Value>
                    <ControlTemplate>
                        <StackPanel Orientation="Horizontal"  ClipToBounds="False">
                            <Border BorderThickness="1" BorderBrush="#FFdc000c" VerticalAlignment="Top">
                                <Grid>
                                    <AdornedElementPlaceholder x:Name="adorner" Margin="-1"/>
                                </Grid>
                            </Border>
                            <Border x:Name="errorBorder" Background="#FFdc000c" Margin="8,0,0,0" ClipToBounds="False"
                                Opacity="1" CornerRadius="0"
                                IsHitTestVisible="False"
                                MinHeight="24" MaxWidth="220" >
                                <TextBlock Text="{Binding ElementName=adorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}"
                                       Foreground="White" Margin="8,2,8,3" TextWrapping="Wrap" VerticalAlignment="Center"/>
                            </Border>
                        </StackPanel>
                        <!--<ControlTemplate.Triggers>
                            <DataTrigger Value="True">
                                <DataTrigger.Binding>
                                    <Binding ElementName="adorner" Path="AdornedElement.IsFocused" />
                                </DataTrigger.Binding>
                                <DataTrigger.EnterActions>
                                    <BeginStoryboard x:Name="fadeInStoryboard">
                                        <Storyboard>
                                            <DoubleAnimation Duration="00:00:00.15"
                                                         Storyboard.TargetName="errorBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="1"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.EnterActions>
                                <DataTrigger.ExitActions>
                                    <StopStoryboard BeginStoryboardName="fadeInStoryboard"/>
                                    <BeginStoryboard x:Name="fadeOutStoryBoard">
                                        <Storyboard>
                                            <DoubleAnimation Duration="00:00:00"
                                                         Storyboard.TargetName="errorBorder"
                                                         Storyboard.TargetProperty="Opacity"
                                                         To="0"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </DataTrigger.ExitActions>
                            </DataTrigger>
                        </ControlTemplate.Triggers>-->
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Border BorderBrush="{StaticResource AccentBrush}" BorderThickness="1" Background="{StaticResource LightBackgroundBrush}"
            Padding="20">
        <Grid>

            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>

            <Grid Grid.Row="1" Grid.Column="0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <StackPanel Grid.Column="0">
                    <Rectangle HorizontalAlignment="Left" Width="100" Height="6" Fill="{StaticResource AccentBrush}" />
                    <TextBlock FontSize="24" Foreground="#444444" FontWeight="Bold" HorizontalAlignment="Stretch" Text="{x:Static p:Resources.ShortLabFormTitle}" TextWrapping="Wrap" />

                    <StackPanel Height="10" />
                    
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="Auto" />
                        </Grid.RowDefinitions>

                        <TextBlock 
                            Grid.Row="0"
                            Grid.Column="0"
                            Text="{x:Static p:Resources.PrintedFormPatientSurname}" 
                            FontWeight="SemiBold" 
                            VerticalAlignment="Center" 
                            Margin="0, 0, 8, 8" />
                        <TextBox 
                            Grid.Row="0"
                            Grid.Column="1"
                            Width="150" 
                            VerticalAlignment="Center" 
                            IsEnabled="False" 
                            IsTabStop="False" 
                            Margin="0, 0, 8, 8"
                            Text="{Binding CaseVM.Surname, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />

                        <TextBlock 
                            Grid.Row="0"
                            Grid.Column="2"
                            Text="{x:Static p:Resources.PrintedFormPatientOtherNames}" 
                            FontWeight="SemiBold" 
                            VerticalAlignment="Center" 
                            Margin="0, 0, 8, 8" />
                        <TextBox 
                            Grid.Row="0"
                            Grid.Column="3"
                            Width="150" 
                            VerticalAlignment="Center" 
                            IsEnabled="False" 
                            IsTabStop="False" 
                            Margin="0, 0, 8, 8"
                            Text="{Binding CaseVM.OtherNames, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />

                        <TextBlock 
                            Grid.Row="1"
                            Grid.Column="0"
                            Text="{x:Static p:Resources.ShortFormCaseID}" 
                            FontWeight="SemiBold" 
                            VerticalAlignment="Center" 
                            Margin="0, 0, 8, 8" />
                        <TextBox 
                            Grid.Row="1"
                            Grid.Column="1"
                            Width="120" 
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center" 
                            IsEnabled="False" 
                            IsTabStop="False" 
                            Margin="0, 0, 8, 8"
                            Text="{Binding CaseVM.ID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />

                        <TextBlock 
                            Grid.Row="1"
                            Grid.Column="2"
                            Text="{x:Static p:Resources.PrintedFormAge}" 
                            FontWeight="SemiBold" 
                            VerticalAlignment="Center" 
                            Margin="0, 0, 8, 8" />
                        <TextBox 
                            Grid.Row="1"
                            Grid.Column="3"
                            Width="50" 
                            HorizontalAlignment="Left"
                            VerticalAlignment="Center" 
                            IsEnabled="False" 
                            IsTabStop="False" 
                            Margin="0, 0, 8, 8"
                            Text="{Binding CaseVM.AgeYears, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />
                    </Grid>
                </StackPanel>
            </Grid>


            <Border BorderThickness="1" BorderBrush="Silver" Grid.Row="2" Grid.Column="0">
                <ScrollViewer VerticalScrollBarVisibility="Visible" Grid.Row="1" Grid.Column="0" VerticalAlignment="Stretch" 
                              >
                    <!-- data entry stuff -->
                    <StackPanel Margin="6">

                        <Grid HorizontalAlignment="Stretch" Height="26" Background="{StaticResource EditionThemeAccentBrush}" Margin="-6, -6, -6, 0">
                            <!--<TextBlock HorizontalAlignment="Left" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Section 1" />-->
                            <TextBlock HorizontalAlignment="Center" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Sample Information" />
                        </Grid>

                        <StackPanel Height="8" />
                        
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                            
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>

                            <TextBlock 
                                Grid.Row="0"
                                Grid.Column="0"
                                Text="{x:Static p:Resources.PrintedFormSampleType}" 
                                FontWeight="SemiBold" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="0"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource SampleTypeListString}"
                                SelectedValue="{Binding SampleType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="1"
                                Grid.Column="0"
                                Text="{x:Static p:Resources.ShortLabFormIfOtherPleaseSpecify}" 
                                VerticalAlignment="Center" 
                                Margin="20, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="1"
                                Grid.Column="1"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8"
                                IsEnabled="{Binding SampleType, Converter={StaticResource SampleTypeToEnabledConverter}}"
                                Text="{Binding SampleOtherType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />


                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="0"
                                FontWeight="SemiBold"
                                Text="{x:Static p:Resources.ShortFormDateSampleCollected}" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <DatePicker 
                                Grid.Row="2"
                                Grid.Column="1"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8"
                                SelectedDate="{Binding DateSampleCollected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True, ValidatesOnNotifyDataErrors=True}" />


                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="0"
                                FontWeight="SemiBold"
                                Text="{x:Static p:Resources.ShortFormFieldLabSpecID}" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="3"
                                Grid.Column="1"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8"
                                Width="150"
                                CharacterCasing="Upper"
                                Text="{Binding FieldLabSpecimenID, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />


                            <!--<TextBlock 
                                Grid.Row="0"
                                Grid.Column="2"
                                FontWeight="SemiBold"
                                Text="UVRI VSPB Log #:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="0"
                                Grid.Column="3"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8"
                                Width="150"
                                Text="{Binding UVRIVSPBLogNumber, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, NotifyOnValidationError=True}" />-->

                            <TextBlock 
                                Grid.Row="0"
                                Grid.Column="2"
                                FontWeight="SemiBold"
                                Text="{x:Static p:Resources.ShortLabFormDaysAcute}" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="0"
                                Grid.Column="3"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8"
                                Width="30"
                                IsEnabled="False"
                                IsTabStop="False"
                                Text="{Binding DaysAcute, Mode=OneWay, NotifyOnValidationError=False}" />



                            <TextBlock 
                                Grid.Row="1"
                                Grid.Column="2"
                                FontWeight="SemiBold"
                                Text="{x:Static p:Resources.ShortFormDateSampleTested}" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <DatePicker
                                Grid.Row="1"
                                Grid.Column="3"
                                HorizontalAlignment="Left"
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8"
                                SelectedDate="{Binding DateSampleTested, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" />



                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="2"
                                Text="{x:Static p:Resources.ShortFormSampleInterpretation}" 
                                FontWeight="SemiBold" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="2"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource SampleInterpretListString}"
                                SelectedValue="{Binding SampleInterpret, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />
                        </Grid>

                        <StackPanel Height="8" />

                        <Grid HorizontalAlignment="Stretch" Height="26" Background="{StaticResource EditionThemeAccentBrush}" Margin="-6, -6, -6, 0" Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource EbolaToVisibilityConverter}}">
                            <!--<TextBlock HorizontalAlignment="Left" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Section 1" />-->
                            <TextBlock HorizontalAlignment="Center" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Ebola (Zaire) Virus Results" />
                        </Grid>

                        <StackPanel Height="8" Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource EbolaToVisibilityConverter}}" />

                        <Grid Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource EbolaToVisibilityConverter}}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>
                            
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <TextBlock 
                                Grid.Row="0"
                                Grid.Column="0"
                                Text="EBOV qRT-PCR 1:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="0"
                                Grid.Column="1"
                                Width="120" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding EBOVPCR, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="1"
                                Grid.Column="0"
                                Text="EBOV qRT-PCR 2:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="1"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding EBOVPCR2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="0"
                                Text="EBOV Antigen:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="2"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding EBOVAg, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="0"
                                Text="EBOV IgM:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="3"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding EBOVIgM, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="4"
                                Grid.Column="0"
                                Text="EBOV IgG:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="4"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding EBOVIgG, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />





                            <TextBlock 
                                Grid.Row="0"
                                Grid.Column="2"
                                Text="EBOV CT1" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="0"
                                Grid.Column="3"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding EBOVPCR, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding EBOVCT1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="1"
                                Grid.Column="2"
                                Text="EBOV CT 2:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="1"
                                Grid.Column="3"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding EBOVPCR2, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding EBOVCT2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="2"
                                Text="EBOV Ag Titer:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="2"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                IsEnabled="{Binding EBOVAg, Converter={StaticResource PCRToEnabledConverter}}"
                                ItemsSource="{StaticResource AgTiterListString}"
                                SelectedValue="{Binding EBOVAgTiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="2"
                                Text="EBOV IgM Titer:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="3"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                IsEnabled="{Binding EBOVIgM, Converter={StaticResource PCRToEnabledConverter}}"
                                ItemsSource="{StaticResource TiterListString}"
                                SelectedValue="{Binding EBOVIgMTiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="4"
                                Grid.Column="2"
                                Text="EBOV IgG Titer:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="4"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                IsEnabled="{Binding EBOVIgG, Converter={StaticResource PCRToEnabledConverter}}"
                                ItemsSource="{StaticResource TiterListString}"
                                SelectedValue="{Binding EBOVIgGTiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />








                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="4"
                                Text="EBOV Ag Sum OD" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="2"
                                Grid.Column="5"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding EBOVAg, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding EBOVAgSumOD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="4"
                                Text="EBOV IgM Sum OD" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="3"
                                Grid.Column="5"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding EBOVIgM, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding EBOVIgMSumOD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="4"
                                Grid.Column="4"
                                Text="EBOV IgG Sum OD" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="4"
                                Grid.Column="5"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding EBOVIgG, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding EBOVIgGSumOD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />
                        </Grid>

                        <StackPanel Height="8" Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource EbolaToVisibilityConverter}}" />






                        <Grid HorizontalAlignment="Stretch" Height="26" Background="{StaticResource EditionThemeAccentBrush}" Margin="-6, -6, -6, 0" Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource MarburgToVisibilityConverter}}">
                            <!--<TextBlock HorizontalAlignment="Left" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Section 1" />-->
                            <TextBlock HorizontalAlignment="Center" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Marburg Virus Results" />
                        </Grid>

                        <StackPanel Height="8" Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource MarburgToVisibilityConverter}}" />

                        <Grid Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource MarburgToVisibilityConverter}}">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition Height="Auto"/>
                            </Grid.RowDefinitions>

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>

                            <TextBlock 
                                Grid.Row="0"
                                Grid.Column="0"
                                Text="MARV Pol qRT-PCR:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="0"
                                Grid.Column="1"
                                Width="120" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding MARVPCR, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="1"
                                Grid.Column="0"
                                Text="MARV VP40 qRT-PCR:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="1"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding MARVPCR2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="0"
                                Text="MARV Antigen:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="2"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding MARVAg, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="0"
                                Text="MARV IgM:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="3"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding MARVIgM, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="4"
                                Grid.Column="0"
                                Text="MARV IgG:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="4"
                                Grid.Column="1"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource PCRListString}"
                                SelectedValue="{Binding MARVIgG, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />





                            <TextBlock 
                                Grid.Row="0"
                                Grid.Column="2"
                                Text="MARV Pol CT:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="0"
                                Grid.Column="3"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding MARVPCR, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding MARVCT1, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="1"
                                Grid.Column="2"
                                Text="MARV VP40 CT:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="1"
                                Grid.Column="3"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding MARVPCR2, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding MARVCT2, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="2"
                                Text="MARV Ag Titer:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="2"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                IsEnabled="{Binding MARVAg, Converter={StaticResource PCRToEnabledConverter}}"
                                ItemsSource="{StaticResource AgTiterListString}"
                                SelectedValue="{Binding MARVAgTiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="2"
                                Text="MARV IgM Titer:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="3"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                IsEnabled="{Binding MARVIgM, Converter={StaticResource PCRToEnabledConverter}}"
                                ItemsSource="{StaticResource TiterListString}"
                                SelectedValue="{Binding MARVIgMTiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="4"
                                Grid.Column="2"
                                Text="MARV IgG Titer:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <ComboBox 
                                Grid.Row="4"
                                Grid.Column="3"
                                Width="Auto" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                IsEnabled="{Binding MARVIgG, Converter={StaticResource PCRToEnabledConverter}}"
                                ItemsSource="{StaticResource TiterListString}"
                                SelectedValue="{Binding MARVIgGTiter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />








                            <TextBlock 
                                Grid.Row="2"
                                Grid.Column="4"
                                Text="MARV Ag Sum OD" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="2"
                                Grid.Column="5"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding MARVAg, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding MARVAgSumOD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="3"
                                Grid.Column="4"
                                Text="MARV IgM Sum OD" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="3"
                                Grid.Column="5"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding MARVIgM, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding MARVIgMSumOD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />

                            <TextBlock 
                                Grid.Row="4"
                                Grid.Column="4"
                                Text="MARV IgG Sum OD" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 8, 8" />
                            <TextBox 
                                Grid.Row="4"
                                Grid.Column="5"
                                Width="60" 
                                VerticalAlignment="Center" 
                                IsEnabled="{Binding MARVIgG, Converter={StaticResource PCRToEnabledConverter}}"
                                Text="{Binding MARVIgGSumOD, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True, NotifyOnValidationError=True, TargetNullValue=''}"
                                Margin="0, 0, 8, 8" />
                        </Grid>

                        <StackPanel Height="8" Visibility="{Binding RelativeSource={RelativeSource
                                Mode=FindAncestor,
                                AncestorType={x:Type Window}},
                                Path=DataContext.VirusTestType, Converter={StaticResource MarburgToVisibilityConverter}}" />


                        <StackPanel Height="8" />
                        
                        <Grid HorizontalAlignment="Stretch" Height="26" Background="{StaticResource EditionThemeAccentBrush}" Margin="-6, -6, -6, 0">
                            <!--<TextBlock HorizontalAlignment="Left" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Section 1" />-->
                            <TextBlock HorizontalAlignment="Center" Margin="8, 0, 0, 0" VerticalAlignment="Center" FontSize="14" FontWeight="SemiBold" Foreground="White" Text="Additional Test Results" />
                        </Grid>

                        <StackPanel Height="8" />

                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="Auto" />
                            </Grid.ColumnDefinitions>
                        <TextBlock 
                                Grid.Row="0"
                                Grid.Column="0"
                                Text="Malaria Rapid Test:" 
                                VerticalAlignment="Center" 
                                Margin="0, 0, 16, 8" />
                        <ComboBox 
                                Grid.Row="0"
                                Grid.Column="1"
                                Width="120" 
                                VerticalAlignment="Center" 
                                DisplayMemberPath="DisplayString"
                                SelectedValuePath="ValueString"
                                ItemsSource="{StaticResource OtherTestResultListString}"
                                SelectedValue="{Binding MRT, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                Margin="0, 0, 8, 8" />
                        </Grid>

                    </StackPanel>
                </ScrollViewer>
            </Border>

            <Grid Grid.Row="0" Grid.RowSpan="4" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0, 72, 0, 0" MaxWidth="300" MaxHeight="110"
              Visibility="{Binding Errors.HasErrors, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}">
                <Grid.Style>
                    <Style TargetType="{x:Type Grid}">
                        <Style.Triggers>
                            <Trigger Property="Visibility" Value="Visible">
                                <Trigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetProperty="(UIElement.Opacity)">
                                                <SplineDoubleKeyFrame KeyTime="00:00:00" Value="0" />
                                                <SplineDoubleKeyFrame KeyTime="00:00:00.200" Value="1" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </Trigger.EnterActions>
                            </Trigger>
                        </Style.Triggers>
                    </Style>
                </Grid.Style>
                <Border BorderBrush="Tomato" BorderThickness="2, 2, 2, 2" Background="White" Padding="10">
                    <Button>
                        <Button.Style>
                            <Style TargetType="{x:Type Button}">
                                <Setter Property="Template">
                                    <Setter.Value>
                                        <ControlTemplate TargetType="{x:Type Button}">
                                            <ContentPresenter />
                                        </ControlTemplate>
                                    </Setter.Value>
                                </Setter>
                            </Style>
                        </Button.Style>
                        <Button.Content>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <StackPanel Grid.Column="1">
                                    <TextBlock Grid.Column="1" TextWrapping="WrapWithOverflow">This lab record contains errors. Please correct all errors before proceeding.</TextBlock>

                                    <Button
                                    Command="{Binding ToggleErrorDisplayCommand}"
                                    HorizontalAlignment="Center" Margin="0, 6, 0, 2">
                                        <Span FontWeight="Bold">View Errors</Span>
                                    </Button>
                                </StackPanel>

                                <StackPanel Grid.Column="0" Margin="0, 0, 20, 0" VerticalAlignment="Center">
                                    <Path Width="24" Height="24" Stretch="Fill" Fill="Tomato" Data="F1 M 58.5832,55.4172L 17.4169,55.4171C 15.5619,53.5621 15.5619,50.5546 17.4168,48.6996L 35.201,15.8402C 37.056,13.9852 40.0635,13.9852 41.9185,15.8402L 58.5832,48.6997C 60.4382,50.5546 60.4382,53.5622 58.5832,55.4172 Z M 34.0417,25.7292L 36.0208,41.9584L 39.9791,41.9583L 41.9583,25.7292L 34.0417,25.7292 Z M 38,44.3333C 36.2511,44.3333 34.8333,45.7511 34.8333,47.5C 34.8333,49.2489 36.2511,50.6667 38,50.6667C 39.7489,50.6667 41.1666,49.2489 41.1666,47.5C 41.1666,45.7511 39.7489,44.3333 38,44.3333 Z "/>
                                </StackPanel>

                            </Grid>
                        </Button.Content>
                    </Button>
                </Border>
            </Grid>
            
            <StackPanel Grid.Row="3" Grid.Column="0" Margin="0, 10, 0, 0" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Margin="5, 5, 5, 0" x:Name="btnSave" MinWidth="130" Height="28" Command="{Binding SaveCommand}" Content="Save" />
                <Button Margin="5, 5, 5, 0" x:Name="btnSaveAndClose" MinWidth="130" Height="28" Command="{Binding SaveAndCloseCommand}" Content="Save and Close" />
                <Button Margin="5, 5, 0, 0" x:Name="btnCancel" MinWidth="130" Height="28" Command="{Binding CancelEditModeCommand}" Content="{x:Static p:Resources.Cancel}"  />
            </StackPanel>

            <local:RecordErrors Margin="-20" Grid.RowSpan="100" Grid.ColumnSpan="100" Visibility="{Binding IsShowingErrorDetailPanel, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}" />
            
        </Grid>
    </Border>
</UserControl>
